package array.nowcoder.easy;

/**
 * @author Stark
 * @description 井字棋
 * 题目链接：https://www.nowcoder.com/practice/e1bb714eb9924188a0d5a6df2216a3d1?
 * tpId=8&&tqId=11055&rp=1&ru=/activity/oj&qru=/ta/cracking-the-coding-interview/question-ranking
 * @date 2022/4/27 21:31
 **/
public class Board {
    public boolean checkWon(int[][] arr) {
        for(int i = 0;i < 3;i++){
            if(arr[0][i] == arr[1][i] && arr[1][i] == arr[2][i] && arr[0][i] == 1)
                return true;
            if(arr[i][0] == arr[i][1] && arr[i][1] == arr[i][2] && arr[i][0] == 1)
                return true;
        }
        if(arr[0][0] == arr[1][1] && arr[1][1] == arr[2][2] && arr[1][1] == 1)
            return true;
        if(arr[0][2] == arr[1][1] && arr[1][1] == arr[2][0] && arr[1][1] == 1)
            return true;
        return false;
    }
}
